package com.benny_driving.thread;

import java.util.List;

import android.os.Handler;
import android.os.Looper;

import com.benny_driving.act.DriInfoAct;
import com.benny_driving.entity.Comment;
import com.benny_driving.http.dao.impl.HttpDaoImpl;

public class DriLstInfoThread extends Thread {
	private String driID;
	private static Handler handler = null;

	public DriLstInfoThread(String driID) {
		this.driID = driID;
		handler = new Handler();
	}

	@Override
	public void run() {
		Looper.prepare();
		List<Comment> lstComment = null;
		try {
			lstComment = HttpDaoImpl.getInstance().getComment(driID);
			if (lstComment != null) {
				DriInfoAct.handler.sendMessage(handler.obtainMessage(
						DriInfoAct.UPDATA_UI, lstComment));
			}
		} catch (Exception e) {
			DriInfoAct.handler.sendMessage(handler.obtainMessage(
					DriInfoAct.NETWORK_ERROR, e.getMessage()));
		} finally {
			Thread.currentThread().interrupt();
		}
	}
}
